import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import About from '../views/About.vue'
import Book from '../views/Book.vue'
import SelectBook from '../views/SelectBook.vue'
import AddBook from '../views/AddBook.vue'
import Index from '../views/Index.vue'
import UpdateBook from '../views/UpdateBook.vue'


Vue.use(VueRouter)

const routes = [
/*  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: About
  },
  {
    path: '/book',
    name: 'Book',
    component: Book
  },*/
  {
    path: '/',
    name: '图书管理',
    component: Index,
    show:true,
    redirect: '/selectBook',
    children: [
      {path: '/selectBook', name: '查询图书', component: SelectBook},
      {path: '/addBook', name: '添加图书', component: AddBook},
    ]
  },
  {
    path: '/update',
    component: UpdateBook,
    show: false  //是否遍历该页面
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
